import 'package:flutter/foundation.dart';
import 'package:loxen/mode/master/master_index_bean.dart';
import 'package:rxdart/rxdart.dart';
import '../api.dart';

mixin FileShowMixin{

  Stream<FileShow> showFile({String userId}) {
    return ApiService.masterIndex(userId: userId).flatMap((value) =>
        compute(decodeMasterBean, value.data).asStream()).flatMap((
        value) => Stream.value(value.data.results));
  }

  static MasterIndexBean decodeMasterBean(dynamic json) {
    return MasterIndexBean.fromJson(json);
  }

}